﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class apps_apps_rs_15_rs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder displayValues = new System.Text.StringBuilder();
        System.Collections.Specialized.NameValueCollection
            postedValues = Request.Form;
        String nextKey;
        for (int i = 0; i < postedValues.AllKeys.Length; i++)
        {
            nextKey = postedValues.Keys[i];
            if (nextKey.Substring(0, 2) != "__")
            {
                //displayValues.Append("<br>");
                //displayValues.Append(nextKey);
                //displayValues.Append(" = ");
                displayValues.Append(postedValues[i]);
                displayValues.Append("|");
            }
        }
        Label1.Text = displayValues.ToString();
        string str = displayValues.ToString();
        string[] chuoitach3 = str.Split('|');
        //bat dau lay gia tri tu chuoi
        if (chuoitach3[27].Trim() != "")
        {
            lblNgayki.Text = chuoitach3[27];
        }
        else
        {
            lblNgayki.Text = "this ____________ day of ______, 20__";
        }
        // dien ten 3 nguoi
        string slchunha=chuoitach3[1];
        string tenchunha1=chuoitach3[3];
        string tenchunha2 = chuoitach3[5];
        string tenchunha3 = chuoitach3[7];
        string slnguoichuyennhuong= chuoitach3[8];
        string tennguoichuyennhuong1 = chuoitach3[10];
        string tennguoichuyennhuong2 = chuoitach3[12];
        string tennguoichuyennhuong3 = chuoitach3[14];
        string slnguoithue= chuoitach3[15];
        string tennguoithue1 = chuoitach3[17];
        string tennguoithue2 = chuoitach3[19];
        string tennguoithue3 = chuoitach3[21];

        if (slchunha == "1")
        {
            lblChunhagoc.Text = tenchunha1;
            lblChuNhaGoc2.Text = tenchunha1;
        }
        else if (slchunha == "2")
        {
            lblChunhagoc.Text = tenchunha1 + " , and " + tenchunha2;
        }else if(slchunha == "3")
        {
            lblChunhagoc.Text = tenchunha1 + " , and " + tenchunha2 + " , and " + tenchunha3;
        }

        if (slnguoichuyennhuong == "1")
        {
            lblChuNhahientai.Text = tennguoichuyennhuong1;
            lblnguoichuyennhuon2.Text = tennguoichuyennhuong1;
        }
        else if (slnguoichuyennhuong == "2")
        {
            lblChuNhahientai.Text = tennguoichuyennhuong1 + " , and " + tennguoichuyennhuong2;
        }
        else if (slnguoichuyennhuong == "3")
        {
            lblChuNhahientai.Text = tennguoichuyennhuong1 + " , and " + tennguoichuyennhuong2 + " , and " + tennguoichuyennhuong3;
        }

        if (slnguoithue == "1")
        {
            lblnguoithue.Text = tennguoithue1;
            lblnguoithuemoi2.Text = tennguoithue1;
        }
        else if (slnguoithue == "2")
        {
            lblnguoithue.Text = tennguoithue1 + " , and " + tennguoithue2;
        }
        else if (slnguoithue == "3")
        {
            lblnguoithue.Text = tennguoithue1 + " , and " + tennguoithue2 + " , and " + tennguoithue3;
        }
        // dien ngay thue + dia chi
        if (chuoitach3[22].Trim() != "")
        {
            lblngaythuegoc.Text = chuoitach3[23];
        }
        else
        {
            lblngaythuegoc.Text = "____________________";
        }

        if (chuoitach3[23].Trim() != "")
        {
            lblDiaChi.Text = chuoitach3[23];
        }
        else
        {
            lblDiaChi.Text = "____________________";
        }
        if (chuoitach3[24] != "")
        {
            lblNgaycohl.Text = chuoitach3[24];
            lblNgaycohl2.Text=chuoitach3[24];
        }
        else
        {
            lblNgaycohl.Text = "_____________________";
            lblNgaycohl2.Text = "______________________";
        }
        // Kiem tra Yes / No
        if (chuoitach3[25] == "yesa")
        {
            lblyesNo.Text = "The Assignor acknowledges that the Landlord's consent to the Assignment will not discharge the Assignor of its obligations under the Lease in the event of a breach by the Assignee.<br><br>";
        }
        if (chuoitach3[25] == "noa")
        {
            lblyesNo.Text = "The Landlord agrees that consent to the Assignment will discharge the Assignor of its obligations under the Lease in the event of a breach by the Assignee, unless the Assignor later retakes possession of the Premises from the Assignee.";
        }
        
        //dieu khoan bo sung
        if (chuoitach3[26] != "")
        {
            lbldkbs.Text = chuoitach3[26];
        }
        else
        {
            lbldkbs.Text = "____________________________";
        }

    }
}
